#ifndef SIMULATOR_H
#define SIMULATOR_H

#include <QtGui/QMainWindow>

class QLabel;
class QTextBrowser;
class QextSerialPort;
class RegisterDef;

namespace Ui
{
    class Simulator;
}

class Simulator : public QMainWindow
{
    Q_OBJECT

public:
    Simulator(QWidget *parent = 0);
    ~Simulator();

private:
    Ui::Simulator *ui;
    QextSerialPort *target;
    QList<RegisterDef> registerList;
    QTextBrowser *ui_textBrowser;
    QLabel *ui_lblPort;

    void createPty();
    QByteArray parseCommand(QByteArray command);
    void writePty(QByteArray reply);
    void generateRegisterList();
    QByteArray sendRegisterList();
    QByteArray readRegister(QByteArray address);
    void writeRegister(QByteArray value);
    QByteArray logDump();

private slots:
    void readPty();
};

#endif // SIMULATOR_H
